#include <cstdio>

using namespace std;

const int maxn=100, maxm=10000;
int n, m;

static int ans[2*maxn+1][maxm+1];

void print(int o) {
    for (int i=0; i<2*n-1 && m; i++) {
        for (int j=0; j<2*n-1; j++) {
            int k=(2*n-1+i-j)%(2*n-1);
            if (j<=k) {
                if (j==k) k=2*n-1;
                ans[j][m] = ans[k][m] = o;
                o = o%n+1;
            }
        }
        m--;
    }
}

int main() {
    freopen("color.in", "r", stdin);
    freopen("color.out", "w", stdout);

    int temp;
    scanf("%d %d", &n, &m);
    temp = m;
    if (n*(2*n-1)<m) printf("-1\n");
    else {
        for (int i=1; i<=n; i++) print(i);
        for (int i=0; i<2*n; i++) {
            for (int j=1; j<=temp; j++) printf("%d ", ans[i][j]);
            printf("\n");
        }
    }

    fclose(stdin);
    fclose(stdout);
    return 0;
}
